package bjtu.pinet.common.pinetpacket;

import org.onlab.packet.BasePacket;
import org.onlab.packet.Deserializer;
import org.onlab.packet.PacketUtils;

import java.io.Serializable;
import java.nio.ByteBuffer;

/**
 * author:chushuai
 * date:2021.2.13
 */
public class Ndn  extends BasePacket implements Serializable {
    public static final int HEADER_LENGTH = 3;

    public static final int TYPE_HOPDATA = 0;
    public static final int TYPE_CSYN = 1;
    public static final int TYPE_CSYN_ACK = 2;
    public static final int TYPE_ASSOCIATION = 6;
    public static final int TYPE_DISASSOCIATION = 7;

    protected int mfType; //32bits
    protected int sourceGuid; //32bits
    protected int destinationGuid; //32bits

    public Ndn() {
        super();
    }

    /**
     * Gets the MobilityFirst type.
     *
     * @return the mfType
     */
    public int getMfType() {
        return this.mfType;
    }

    /**
     * Gets the Guid of source node.
     *
     * @return the sourceGuid / HostGuid
     */
    public int getSrcGuid() {
        return this.sourceGuid;
    }

    /**
     * Gets the Guid of destination node.
     *
     * @return the destinationGuid / ApGuid
     */
    public int getDstGuid() {
        return this.destinationGuid;
    }

    /**
     * Deserializer function for MF packets.
     *
     * @return deserializer function
     */
    public static Deserializer<Ndn> deserializer() {
        return (data, offset, length) -> {
            PacketUtils.checkInput(data, offset, length, 40);
            Ndn ndn = new Ndn();
            ByteBuffer bb = ByteBuffer.wrap(data, offset, length);
            int iscratch = bb.getInt();
            Deserializer deserializer;
            return ndn;
        };
    }

    public static void main(String[] args) {
        System.out.println(1);
    }


    @Override
    public byte[] serialize() {
        return new byte[0];
    }
}
